<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>中介房源管理</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <style type="text/css">
        .layui-table-cell {
            height: 100%;
            max-width: 100%;
        }
    </style>
</head>
<body>



<div id="test4" class="demo-tree"></div>





<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">


    layui.use(['tree', 'layer', 'util'], function () {
        var tree = layui.tree;
        var layer = layui.layer;
        var util = layui.util;

        getTree();

        var data1 = [];

        function getTree() {
            $.ajax({
                url: 'house-room-intermediary/tree',
                type: 'get',
                success : function (result) {
                    if (result.code == 200) {
                        data1 = result.data;
                        //重载
                        tree.reload('demoId', {
                           data: data1
                        });
                    }
                }
            });
        }

        //手风琴模式
        tree.render({
            elem: '#test4'
            ,data: data1
            ,accordion: true
            ,id: 'demoId'
        });

    });
</script>


</body>
</html>